/*-
 * Copyright (c) 2009-2010 David Forsythe.
 * See LICENSE file for license details.
 */

#ifndef __LIBPKG_PKG_PKG_H__
#define __LIBPKG_PKG_PKG_H__

#include <stdio.h>
#include <archive_entry.h>

struct pkg;
struct parser_writer_vtable;
struct meta_entry;
struct install_vtable;

/* 
 * Create a new pkg to store package information and interact with package
 * databases.
 */
struct pkg *pkg_create(void);

void pkg_clear(struct pkg *);

void pkg_release(struct pkg *);

struct pkg_property *pkg_get_property_list(struct pkg *);

void pkg_set_key(struct pkg *, const char *);

const char *pkg_get_key(struct pkg *);

void pkg_set_parser_writer_vtable(struct pkg *, struct parser_writer_vtable *);

void pkg_set_meta_entry_table(struct pkg *, struct meta_entry *);

struct meta_entry *pkg_get_meta_entry_table(struct pkg *);

int pkg_parse_FILE(struct pkg *, FILE *, const char *);

int pkg_parse_fd(struct pkg *, int, size_t, const char *);

int pkg_parse(struct pkg *, char *, const char *);

int pkg_register_script(struct pkg *, const char *, const char *);

const char *pkg_get_script_pathname(struct pkg *p, const char *name);

int pkg_write_FILE(struct pkg *, FILE *, const char *);

int pkg_meta_entry(struct pkg *, struct archive_entry *);

#endif
